cmake_minimum_required(VERSION 3.22.1)

get_filename_component(example_name ${CMAKE_CURRENT_LIST_DIR} NAME)

project(${example_name})

if(NOT DART_BUILD_COLLISION_BULLET)
  if(DART_VERBOSE OR NOT DART_IN_SOURCE_BUILD)
    message(STATUS "Skipping ${example_name} tutorial (requires DART_BUILD_COLLISION_BULLET=ON)")
  endif()
  return()
endif()

set(required_components utils-urdf gui)
set(required_libraries dart dart-utils-urdf dart-gui)

if(DART_IN_SOURCE_BUILD)
  dart_build_tutorial_in_source(${example_name} LINK_LIBRARIES ${required_libraries})
  return()
endif()

find_package(DART 6.16.0 REQUIRED COMPONENTS ${required_components} CONFIG)

file(GLOB srcs "*.cpp" "*.hpp")
add_executable(${example_name} ${srcs})
target_link_libraries(${example_name} PUBLIC ${required_libraries})
